import request from '@/utils/request'
/**
 * 获取部门列表
 * @returns
 */
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}
/**
 * 新增部门
 * @param {Object} data {code:'',introduce:'',manager:'',name:'',pid:''}
 * @returns
 */
export function addDepartment(data) {
  return request({
    method: 'POST',
    url: '/company/department',
    data
  })
}
/**
 * 编辑部门
 * @param {Object} data {id:'',code:'',introduce:'',manager:'',name:'',pid:''}
 * @returns
 */
export function editDepartment(data) {
  return request({
    method: 'PUT',
    url: `/company/department/${data.id}`,
    data
  })
}
/**
 * 删除部门
 * @param {*} id
 * @returns
 */
export function delDepartment(id) {
  return request({
    method: 'DELETE',
    url: `/company/department/${id}`
  })
}

/**
 * 获取部门详情数据
 * @param {*} id
 * @returns
 */
export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}
